package com.zr.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.zr.dao.KcxgDaoljc;
import com.zr.util.JDBCUtil;

public class KcxgDaoImplljc implements KcxgDaoljc{

	@Override
	public boolean updateCourse(int cid,String cname, String classtime, String place, int tid) {
		boolean flag = false;
		StringBuffer sql = new StringBuffer("");
		sql.append(" UPDATE course SET");
		sql.append(" cname=?,classtime=?,place=?,tid=?");
		sql.append(" WHERE cid=?");
		Connection con = JDBCUtil.getConnection();
		try {
			PreparedStatement pst = con.prepareStatement(sql.toString());
			pst.setString(1, cname);
			pst.setString(2, classtime);
			pst.setString(3, place);
			pst.setInt(4, tid);
			pst.setInt(5, cid);
			int i = pst.executeUpdate();
			if(i>0){
				flag=true;
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}		
		return flag;
	}

}
